#include <iostream>
#include <vector>
using namespace std;
vector<int> a;
int main() {
    int n, m;
    cin >> n >> m;
    while(n--) {
        int temp;
        cin >> temp;
        a.push_back(temp);
    }
    while(m--) {
        int temp;
        cin >> temp;
        cout << a[temp - 1] << endl;
    }
    return 0;
}